//
//  MagneticObject.m
//  StarBugs
//
//  Created by ?? ? on 5/31/12.
//  Copyright 2012 antisword@playorca.com. All rights reserved.
//

#include "Object/MagneticObject.h"
#include "Util/ImageManager.h"

MagneticObject::~MagneticObject()
{
    
}

MagneticObject::MagneticObject()
{
    mainSprite = ImageManager::getSpriteWithXml2(kImagesheet_GameSource, "item_magnetic");
    addChild(mainSprite);
    bubble = ImageManager::getSpriteWithXml2(kImagesheet_GameSource, "item_bubble");
    bubble->setPosition(ccp(mainSprite->getContentSize().width/2,mainSprite->getContentSize().height/2 ));
    mainSprite->addChild(bubble);
    CCScaleTo *scale = CCScaleTo::create(0.3, 1.1, 0.9);
    CCScaleTo *scale2 = CCScaleTo::create(0.3, 0.9, 1.1);
    bubble->runAction(CCRepeatForever::create((CCActionInterval*)CCSequence::create(scale, scale2, NULL)));
    objectType = objectType_magnetic;
    enableFlg = true;
}


void MagneticObject::setBody(b2World* _world)
{
    mainSprite->setPosition(position);
    mainSprite->setRotation(bodyAngle);
}
